﻿function TestLandingPageURL() {
    ULSFJS: ;
    try {
        // Get a ref to the landing page control
        var LandingPageUrlCtrl = (document.getElementById("ctl00_PlaceHolderMain_LandingPage"));

        // See if we found it
        if (LandingPageUrlCtrl != null) {

            // Set Variables
            var LandingPageURL = LandingPageUrlCtrl.value;
            var TestURL = "";
            
            // Get the site URL
            var Context = new SP.ClientContext();
            var RelativeURL = Context.get_url();

            // See if this is the default or a named site collection
            if (RelativeURL == "/") {
                TestURL = LandingPageURL;
            }
            else {
                TestURL = RelativeURL + LandingPageURL;
            }

            // Open the page
            window.open(TestURL);
        }
    }
    catch (e) {
    }
}